<template>
  <div class="main-container container-limited container-fluid page-holder" v-loading="loading">
    <div class="page-title-holder">
      <h2 class="page-title">每周收集推广信息(数据已固定，线上版使用）</h2>
    </div>
    <el-table :data="infos">
      <el-table-column label="id" prop="id" />
      <el-table-column label="资源数" prop="files" />
      <el-table-column label="问题数" prop="issues" />
    </el-table>
  </div>
</template>

<script>
export default {
  name: 'PopularizeInfo',
  data() {
    return {
      infos: [],
      loading: false,
      ids: [146, 491, 506, 489, 488, 518, 507, 509, 508, 510, 512, 515, 514],
    };
  },
  created() { this.loadInfos(); },
  methods: {
    loadInfos() {
      this.loading = true;
      this.$api.other.popularizeInfos({ spaceIds: this.ids })
        .then((res) => {
          this.infos = this.ids.map(id => ({
            id,
            files: res.data.file[id],
            issues: res.data.issue[id],
          }));
        })
        .catch(() => {})
        .then(() => { this.loading = false; });
    },
  },
};
</script>

<style></style>
